package com.sd.view;

import java.util.Vector;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.alex.books.BaseBook;
import com.sd.activity.r.R;


public class ReaderSetAdapter extends BaseAdapter {

	private Vector<BaseBook> mBooks;
	private LayoutInflater mLayoutInflater;
	private Context mContext;
	private int[] mResouceIds = { R.string.str_readset_fontsize,
			R.string.str_readset_family, R.string.str_readset_bg,
			R.string.str_readset_fontstyle, R.string.str_readset_readmodel };

	public ReaderSetAdapter(Context context) {
		mContext = context;
		mLayoutInflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mResouceIds.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return mResouceIds[position];
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder holder = null;
		if (convertView == null) {
			holder = new ViewHolder();
			convertView = mLayoutInflater.inflate(R.layout.readerset_list, null);
			holder.readerSetName = (TextView) convertView.findViewById(R.id.readerset_name);
			holder.readerText = (TextView) convertView.findViewById(R.id.readerset_text);
			holder.readerImage = (ImageView) convertView.findViewById(R.id.readerset_img);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		holder.readerSetName.setText(mContext.getResources().getString(mResouceIds[position]));

		switch (mResouceIds[position]) {
		case R.string.str_readset_fontsize:
			break;
		case R.string.str_readset_family:
			break;
		case R.string.str_readset_bg:

			break;
		case R.string.str_readset_fontstyle:

			break;
		case R.string.str_readset_readmodel:

			break;

		default:
			break;
		}

		return convertView;
	}

	class ViewHolder {
		/**
		 */
		TextView readerSetName;
		/**
		 */
		ImageView readerImage;
		TextView readerText;
	}

}
